package com.project.slsx.adapter;

import android.util.Log;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.project.slsx.R;
import com.project.slsx.bean.CashGoodsListBean;

import java.util.ArrayList;

public class CategoryAdapter extends BaseQuickAdapter<CashGoodsListBean.CategoryBean, BaseViewHolder> {
    private ArrayList<Boolean> selected = new ArrayList<>();

    public ArrayList<Boolean> getSelected() {
        return selected;
    }

    public void setSelected(ArrayList<Boolean> selected) {
        this.selected = selected;
    }

    public CategoryAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder holder, CashGoodsListBean.CategoryBean item) {
        holder.setText(R.id.tv_cash_title, item.getTitle());
        View bgView = holder.getView(R.id.item_bg);
        bgView.setSelected(selected.get(holder.getLayoutPosition()));
        Log.i(TAG, "convert: " + selected.get(holder.getLayoutPosition()));

    }

    public void setSelect(ArrayList<Boolean> selected) {
        this.selected = selected;
        notifyDataSetChanged();
    }
}
